package com.quma.test;
/**
 * @author 锟斤拷锟斤拷伟锟斤拷 锟斤拷微锟斤拷锟斤拷http://weibo.com/taoandtao
 * @date 锟斤拷2012/12/11
 * @place锟斤拷锟斤拷锟捷达拷学锟斤拷锟斤拷锟斤拷锟窖г�
 */
import java.math.BigDecimal;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Connection;
import java.sql.Statement;

import com.quma.statistics.MysqlConnection;
import com.quma.statistics.entity.GoldUseInfo;
import com.quma.statistics.entity.LogoutData;
import com.quma.statistics.entity.RechargeData;
import com.quma.statistics.impl.GoldUseInfoDaoImpl;
import com.quma.statistics.impl.LogOutDaoImpl;
import com.quma.statistics.impl.RechargeDaoImpl;
 
 
public class Main {
    public static void main(String[] args) throws Exception {
//        Connection conn = null;
//        String sql;
//        // MySQL锟斤拷JDBC URL锟斤拷写锟斤拷式锟斤拷jdbc:mysql://锟斤拷锟斤拷锟斤拷锟狡ｏ拷锟斤拷锟接端匡拷/锟斤拷锟捷匡拷锟斤拷锟斤拷锟�锟斤拷锟斤拷=值
//        // 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷要指锟斤拷useUnicode锟斤拷characterEncoding
//        // 执锟斤拷锟斤拷锟捷匡拷锟斤拷锟街耙拷锟斤拷锟斤拷菘锟斤拷锟斤拷系统锟较达拷锟斤拷一锟斤拷锟斤拷锟捷库，锟斤拷锟斤拷锟皆硷拷锟斤拷锟斤拷
//        // 锟斤拷锟斤拷锟斤拷锟街帮拷锟揭拷却锟斤拷锟絡avademo锟斤拷锟捷匡拷
//        String url = "jdbc:mysql://www.686wan.com:3306/test?"
//                + "user=root&password=12qw!@QW&useUnicode=true&characterEncoding=UTF8";
// 
//        try {
//            // 之锟斤拷锟斤拷要使锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷洌拷锟斤拷锟轿癸拷锟組ySQL锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷要锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
//            // 锟斤拷锟斤拷通锟斤拷Class.forName锟斤拷锟斤拷锟斤拷锟截斤拷去锟斤拷也锟斤拷锟斤拷通锟斤拷锟斤拷始锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷式锟斤拷锟斤拷锟斤拷
//            Class.forName("com.mysql.jdbc.Driver");// 锟斤拷态锟斤拷锟斤拷mysql锟斤拷锟斤拷
//            // or:
//            // com.mysql.jdbc.Driver driver = new com.mysql.jdbc.Driver();
//            // or锟斤拷
//            // new com.mysql.jdbc.Driver();
// 
//            System.out.println("锟缴癸拷锟斤拷锟斤拷MySQL锟斤拷锟斤拷锟斤拷锟斤拷");
//            // 一锟斤拷Connection锟斤拷锟斤拷一锟斤拷锟斤拷锟捷匡拷锟斤拷锟斤拷
//            conn = DriverManager.getConnection(url);
//            // Statement锟斤拷锟斤拷锟斤拷泻芏喾斤拷锟斤拷锟斤拷锟斤拷锟絜xecuteUpdate锟斤拷锟斤拷实锟街诧拷锟诫，锟斤拷锟铰猴拷删锟斤拷锟斤拷
//            Statement stmt = conn.createStatement();
//            sql = "create table student(NO char(20),name varchar(20),primary key(NO))";
//            int result = stmt.executeUpdate(sql);// executeUpdate锟斤拷锟结返锟斤拷一锟斤拷锟斤拷影锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷-1锟斤拷没锟叫成癸拷
//            if (result != -1) {
//                System.out.println("锟斤拷锟斤拷锟斤拷锟捷憋拷晒锟�);
//                sql = "insert into student(NO,name) values('2012001','锟斤拷伟锟斤拷')";
//                result = stmt.executeUpdate(sql);
//                sql = "insert into student(NO,name) values('2012002','锟斤拷小锟斤拷')";
//                result = stmt.executeUpdate(sql);
//                sql = "select * from student";
//                ResultSet rs = stmt.executeQuery(sql);// executeQuery锟结返锟截斤拷锟斤拷募锟斤拷希锟斤拷锟斤拷蚍祷乜锟街�
//                System.out.println("学锟斤拷\t锟斤拷锟斤拷");
//                while (rs.next()) {
//                    System.out
//                            .println(rs.getString(1) + "\t" + rs.getString(2));// 锟斤拷锟斤拷锟斤拷锟斤拷氐锟斤拷锟絠nt锟斤拷锟酵匡拷锟斤拷锟斤拷getInt()
//                }
//            }
//        } catch (SQLException e) {
//            System.out.println("MySQL锟斤拷锟斤拷锟斤拷锟斤拷");
//            e.printStackTrace();
//        } catch (Exception e) {
//            e.printStackTrace();
//        } finally {
//            conn.close();
//        }
    	MysqlConnection.init("www.686wan.com", 3306, "test", "root", "12qw!@QW");

//    	GoldUseInfoDaoImpl impl = new GoldUseInfoDaoImpl();
//    	GoldUseInfo info= new GoldUseInfo(0, System.currentTimeMillis()/1000, "abc", "asd", "asd",new BigDecimal("123"));
//    	impl.save(info);
    	RechargeData data = new RechargeData(null,123,123,new BigDecimal("123"),"asds","sdsdd",1,"aaaaaa","asds","asdsd");
    	RechargeDaoImpl impl = new RechargeDaoImpl();
    	impl.save(data);
    }
 
}